namespace FIREFLYX {
    /** 按键管理器 */
    export class KeyboardManager {
        public static instance: KeyboardManager = new KeyboardManager();
        public init(list: [string, () => any][]) {
            list.push(["keydown", this._onkeyDown.bind(this)]);
            list.push(["keypress", this._onkeyDown.bind(this)]);
            list.push(["keyup", this._onkeyUp.bind(this)]);
        }

        private _onkeyDown(e: KeyboardEvent) {
            GlobalEventManager.Instance.dispatchEvent("keydown", e);
        }
        private _onkeyUp(e: KeyboardEvent) {
            GlobalEventManager.Instance.dispatchEvent("keyup", e);
        }
    }
}
